Write CR/LF only from NON-Windows based platforms.
authoroliskoli <oliskoli@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Mon, 12 Dec 2005 23:58:59 +0000 (23:58 +0000)
committeroliskoli <oliskoli@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Mon, 12 Dec 2005 23:58:59 +0000 (23:58 +0000)
gpsbabel/bcr.c
gpsbabel/stmwpp.c

index e2e1e58e9a64f5d60706beee160f0b1e523cddaa..5dd58435d9e2521ddf4154337c2707a06a9fe266 100644 (file)
 
 #define R_EARTH                6371000         /* radius of our big blue ball */
 
+#if defined (__WIN32__) || defined (__CYGWIN__)
+#define CRLF "\n"
+#else
+#define CRLF "\r\n"
+#endif
+
 /*  
     6371014 would be a better value when converting to f.e. to mapsoure,
     but this seems to be used by Map&Guide when exporting to XML. 
@@ -373,7 +379,7 @@ void bcr_write_line(FILE *fout, const char *key, int *index, const char *value)
 {
        if (value == NULL)                              /* this is mostly used in the world of windows */
        {                                               /* so we respectfully add a CR/LF on each line */
-           fprintf(fout, "%s\x0d\n", key);
+           fprintf(fout, "%s%s", key, CRLF);
        }
        else
        {
@@ -381,9 +387,9 @@ void bcr_write_line(FILE *fout, const char *key, int *index, const char *value)
            
            tmp = (value != NULL) ? xstrdup(value) : xstrdup("");
            if (index != NULL)
-               fprintf(fout, "%s%d=%s\x0d\n", key, *index, tmp);
+               fprintf(fout, "%s%d=%s%s", key, *index, tmp, CRLF);
            else
-               fprintf(fout, "%s=%s\x0d\n", key, tmp);
+               fprintf(fout, "%s=%s%s", key, tmp, CRLF);
            xfree(tmp);
        }
 }
index 638ee4adf866e9e86571c0d7c16b18d935789e82..ae21002998831474722cc40a83907de646d3bc3d 100644 (file)
@@ -33,6 +33,12 @@ static waypoint *wpt;
 
 #define MYNAME "STMwpp"
 
+#if defined (__WIN32__) || defined (__CYGWIN__)
+#define CRLF "\n"
+#else
+#define CRLF "\r\n"
+#endif
+
 #define STM_NOTHING    0
 #define STM_WAYPT      1
 #define STM_TRKPT      2
@@ -248,7 +254,7 @@ stmwpp_waypt_cb(const waypoint *wpt)
                        fprintf(fout, ".%03d", wpt->centiseconds * 10);
                        break;
        }
-       fprintf(fout, ",\r\n");
+       fprintf(fout, ",%s", CRLF);
 }
 
 static void
@@ -260,7 +266,7 @@ stmwpp_data_write(void)
        else
                track_index = 1;
                
-       fprintf(fout, "Datum,WGS 84,WGS 84,0,0,0,0,0\r\n");
+       fprintf(fout, "Datum,WGS 84,WGS 84,0,0,0,0,0%s", CRLF);
        
        switch(global_opts.objective)
        {